package com.zhao.savepassword;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.widget.Toast;

import java.util.ArrayList;

/**
 * Created by zhao on 16-2-4.
 *  Account Activity
 */
public class AccountActivity extends FragmentActivity {
    private static ArrayList<Account> list;
    private final String TAG = "onFragmentActivity";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_account);
        Log.d(TAG,"1");
        init();
    }
    private void init(){
        list = new ArrayList<>();
        //test add 100 account in list
        for (int i =0 ; i<100;i++){
            list.add(new Account("a#"+i,i+1000+"",i+i+""));
        }
        FragmentManager fm = getSupportFragmentManager();
        Fragment fragment = fm.findFragmentById(R.id.fl_account_activity);
        if (fragment==null){
            fragment = new AccountListFragment();
            fm.beginTransaction()
                    .add(R.id.fl_account_activity,fragment)
                    .commit();
        }
    }

    //return list
    public static ArrayList<Account> getList() {
        return list;
    }
}
